package com.wkbb.basic.config;

import com.wkbb.basic.filter.TokenFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class UserFilterConfig {

    @Bean
    public FilterRegistrationBean authCheckBean(){

        FilterRegistrationBean registrationBean =  new FilterRegistrationBean();

        TokenFilter tokenFilter = new TokenFilter();
        registrationBean.setFilter(tokenFilter);
        List<String> urlPatterns = new ArrayList<String>();
        //urlPatterns.add("/*");
        urlPatterns.add("/basic/*");
        registrationBean.setUrlPatterns(urlPatterns);

        return registrationBean;

    }

}